/**
 * 
 */
package org.cuatrovientos.loopsexercise6;

import java.util.Scanner;

/**
 * @author jmaria_iturbe
 *
 */
public class LoopsExercise6 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		int number = 0;
		int result = 1;
		Scanner reader = new Scanner(System.in);
		String line = "";
		
		System.out.println("Enter a number: ");
		line = reader.nextLine();
		number = Integer.parseInt(line);
		
		if (number > 0) 
		{
			for (int i = number; i >1; i--)
			{
				result = result * i;
				
			}
		System.out.println("The factorial is: " + result);	
		}else
		{System.out.println("Error");
		
		
	}
	}
}
